package com.smm.web.vmc.controller;

/**
 * Created by Administrator on 2017/6/28.
 */
import com.smm.web.vmc.domain.Receipt;
import com.smm.web.vmc.handler.MinaClient;
import com.smm.web.vmc.service.CameraService;
import com.smm.web.vmc.service.ReceiptService;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping({"/rep"})
public class RepController {
    @Resource
    private ReceiptService receiptService;
    @Resource
    private CameraService cameraService;

    public RepController() {
    }

    @RequestMapping({"/info.do"})
    public ModelAndView info(String no) {
        ModelAndView mv = new ModelAndView("rep/info");
        Receipt receipt = this.receiptService.getOneById(no);
        List relationCameraList = this.cameraService.getAllByReceipt(no);

        //点亮仓单led
        MinaClient.litReceipt(receipt);

        mv.addObject("receiptNo", no);
        mv.addObject("receipt", receipt);
        mv.addObject("relationCameraList", relationCameraList);

        return mv;
    }
}